/* -----------------------------------------------------------
 * Author: Marie Caswell
 * Testing Function: Smithy Card - Random Tester

 * Description: Tests the smithy card with randomly generated initialization parameters
 * for hand count and deck count
 -----------------------------------------------------------*/

#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "rngs.h"
#include <time.h>

#define MAX_HAND 500
#define MAX_DECK 500

int main()
 {

srand(time(NULL));
int seed = 1000;
int numPlayer = 2;
struct gameState G;
int k[10] = {adventurer, outpost, salvager, village, minion, feast, mine, sea_hag, estate, smithy};
memset(&G, 23, sizeof(struct gameState));   // clear the game state
initializeGame(numPlayer, k, seed, &G); // initialize a new game 
G.handCount[0] = rand() % MAX_HAND; //randomize initial hand count for player 1
G.deckCount[0] = rand() % MAX_DECK; // randomize initial deck count

printf("\nInitial Deck Count: %d\n", G.deckCount[0]);
int deckTracker = G.deckCount[0];
printf("Initial Hand Count: %d\n", G.handCount[0]);
int countTracker = G.handCount[0];

smithyCard(0, &G, 4); //play Smithy

printf("Post-Smithy Deck Count: %d\n", G.deckCount[0]);
assert(deckTracker - G.deckCount[0] == 3);  //draw three cards from deck, deck reduced by three
printf("Post-Smithy Hand Count: %d\n\n", G.handCount[0]);
assert(G.handCount[0] == countTracker + 2);  //draw three cards, discard smithy

printf("\nTests Passed\n\n");

return 0;

 }